using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace Umdf.SideShow.PocketPC
{
    public class SideShowApplicationCollection : KeyedCollection<Guid, SideShowApplication>
    {
        public event EventHandler ListChanged;

        protected virtual void OnListChanged()
        {
            if (ListChanged != null)
            {
                ListChanged(this, EventArgs.Empty);
            }
        }

        protected override Guid GetKeyForItem(SideShowApplication item)
        {
            return item.Id;
        }

        protected override void ClearItems()
        {
            base.ClearItems();
            OnListChanged();
        }

        protected override void InsertItem(int index, SideShowApplication item)
        {
            base.InsertItem(index, item);
            OnListChanged();
        }

        protected override void RemoveItem(int index)
        {
            base.RemoveItem(index);
            OnListChanged();
        }

        protected override void SetItem(int index, SideShowApplication item)
        {
            base.SetItem(index, item);
            OnListChanged();
        }

    }
}
